< Prev(J) / Next(K) > / View :

Filename: /text/sbasic/shared/03103300.xhp

(section: optionexplicit) (bookmark: bm_id3145090)
Option Explicit statement

Option Explicit ステートメント

Option Explicit Statement [Runtime]
Option Explicit ステートメント [実行時](hd_id3145090.1)

Specifies that every variable in the program code must be explicitly declared with the Dim statement.
プログラムコード中で使用するすべての変数を、Dim ステートメントを使って明示的に宣言する必要があるようにします。(par_id3148538.2)

(/section: optionexplicit)

Syntax:
構文:(hd_id3149763.3)

Option Explicit
Option Explicit(par_id3149514.4)

Parameters:
パラメータ:(hd_id3145315.5)

Warning Icon 警告マーク This statement must be added before the executable program code in a module.
このステートメントを記述するプログラム中の位置は、モジュール内のすべての実行コードよりも前にする必要があります。(par_id3145172.6)

Example:
例:(hd_id3125864.7)

Option Explicit
Option Explicit(par_id3154217.8)

Sub ExampleExplicit
Sub ExampleExplicit(par_id3156214.9)

Dim sVar As String
Dim sVar As String(par_id3153193.10)

sVar = "Las Vegas"
sVar = "Las Vegas"(par_id3159252.11)

For i% = 1 to 10 REM This results in a run-time error
For i% = 1 to 10 REM これは実行時エラーとなります(par_id3145787.12)

REM
REM(par_id3152598.13)

Next i%
Next i%(par_id3145749.14)

End Sub
End Sub(par_id3150010.15)


< Prev / Next >